/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-09-23
 * Time: 16:39
 */

public class test2 {

    public static void main(String[] args) {

    }

    public static String fun(String s) {
        char[] arr = s.toCharArray();
        if (s.length() == 1) {
            return s;
        }

        StringBuilder sb = new StringBuilder();
        for(int i = 1; i < arr.length; i++) {
            if(arr[i] == arr[i - 1]) {
                sb.append(s, 0, i - 1).append(s, i + 1, s.length());
                fun(sb.toString());
            }
        }
        return sb.toString();
    }
}
